<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:c="http://java.sun.com/jstl/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich"
	template="/layout/template.xhtml">

	<ui:define name="content">

		<f:view>


			<h:form id="accesslog_form_id">

				<h1>
					<h:outputText value="#{global.accesslog_form_title}" />
				</h1>
				<h2>
					<h:outputText value="#{global.edit}" />
				</h2>


				<rich:tabPanel switchType="client">
					<rich:tab header="#{global.accesslog_settings}">
						<dl>

							<dt>
								<h:outputLabel for="subject_id"
									value="#{global.accesslog_name}:">
									<h:message style="color: red" for="subject_id"
										showSummary="true" showDetail="true" />
								</h:outputLabel>
							</dt>
							<dd>
								<h:inputText style="width: 300px;" required="true"
									value="#{accessLogMB.accessLog.name}" id="subject_id">
								</h:inputText>
							</dd>

							<!-- Log file path -->
							<dt>
								<h:outputLabel value="#{global.accesslog_path}:" />
							</dt>
							<dd>
								<h:inputText style="width: 300px;" required="true"
									value="#{accessLogMB.accessLog.path}" />
							</dd>

							<!-- Log file name -->
							<dt>
								<h:outputLabel value="#{global.accesslog_file}:" />
							</dt>
							<dd>
								<h:inputText style="width: 300px;" required="true"
									value="#{accessLogMB.accessLog.logfile}" />
							</dd>

							<!-- Log Format -->
							<dt>
								<h:outputLabel value="#{global.accesslog_format}:" />
							</dt>
							<dd>
								<h:selectOneMenu value="#{accessLogMB.accessLog.logformat}"
									converter="javax.faces.Byte">
									<f:selectItem itemValue="1" itemLabel="ACCESS_FORMAT_COMMON" />
									<f:selectItem itemValue="2" itemLabel="ACCESS_FORMAT_COMBINED" />
									<f:selectItem itemValue="3" itemLabel="GLASSFISH 3.1" />
								</h:selectOneMenu>
							</dd>



							<dt>
								<h:outputLabel value="#{global.accesslog_lastscan}:" />
								<h:outputText value="#{accessLogMB.accessLog.lastscan.time}">
									<f:convertDateTime timeZone="#{global.timeZone}"
										pattern="#{global.dateTimePattern}" />
								</h:outputText>
							</dt>


							<dt>
								<h:outputLabel value="#{global.accesslog_count}:" />
								<h:outputText value="#{accessLogMB.accessLog.totalcount}" />
							</dt>
						</dl>

					</rich:tab>
					<rich:tab header="#{global.accesslog_logfiles}">
						<rich:dataTable columns="7" value="#{accessLogMB.logFiles}"
							var="record">


							<rich:column style="width:200px;"  sortBy="#{record.id}" sortable="true"
								sortExpression="#{record.id}">
								<f:facet name="header">
									<h:outputText value="Name" />
								</f:facet>
								<h:outputText value="#{record.name}" />
							</rich:column>


							<rich:column>
								<f:facet name="header">
									<h:outputText value="#{global.accesslog_lastmodified}" />
								</f:facet>
								<h:outputText value="#{record.lastmodified.time}">
									<f:convertDateTime timeZone="#{global.timeZone}"
										pattern="#{global.dateTimePattern}" />
								</h:outputText>
							</rich:column>

							<rich:column>
								<f:facet name="header">
									<h:outputText value="#{global.accesslog_lastentry}" />
								</f:facet>
								<h:outputText value="#{record.lastentry.time}">
									<f:convertDateTime timeZone="#{global.timeZone}"
										pattern="#{global.dateTimePattern}" />
								</h:outputText>
							</rich:column>

						</rich:dataTable>

					</rich:tab>
				</rich:tabPanel>


				<h:commandButton actionListener="#{accessLogMB.doSave}"
					action="/pages/accessloglist" value="#{global.save}">
				</h:commandButton>


				<h:commandButton actionListener="#{accessLogMB.doScan}"
					action="/pages/accesslog" value="#{global.accesslog_scan}">
				</h:commandButton>

				<h:commandButton actionListener="#{accessLogMB.doClear}"
					action="/pages/accesslog" value="#{global.accesslog_clear}">
				</h:commandButton>



				<h:commandButton value="#{global.close}"
					action="/pages/accessloglist" />



			</h:form>
		</f:view>
	</ui:define>



</ui:composition>
